//
//  HRZTotalCountCell.m
//  EMarket
//
//  Created by 石头 on 2018/5/21.
//  Copyright © 2018 好日子. All rights reserved.
//

#import "HRZTotalCountCell.h"

#import "HRZStoreModel.h"
#import "HRZGoodsModel.h"

@interface HRZTotalCountCell()

@property (weak, nonatomic) IBOutlet UILabel *storeSpendMoney;
@property (weak, nonatomic) IBOutlet UILabel *buyCount;

@end

@implementation HRZTotalCountCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)setStoreModel:(HRZStoreModel *)storeModel {
    _storeModel = storeModel;
    
    self.buyCount.text = [NSString stringWithFormat:@"总计%lu件商品 合计：", (unsigned long)_storeModel.goodsArray.count];
    float count = 0.0;
    for (HRZGoodsModel *goodsModel in _storeModel.goodsArray) {
        count += [goodsModel.realPrice doubleValue] * [goodsModel.count intValue];
    }
    self.storeSpendMoney.text = [NSString stringWithFormat:@"%.2f", count];
}

@end
